<template>
  <view>
    <recruitPost ref="recruit" v-if="userType === '1'"></recruitPost>
    <!-- <person v-else></person> -->
    <talentsMain v-else ref="talent"></talentsMain>
  </view>
</template>

<script>
import { mapState } from "vuex";

import talentsMain from "@/components/enterprise/talents.vue";

import recruitPost from "../../recruit/post/index.vue";

export default {
  components: {
    recruitPost,
    talentsMain,
  },
  data() {
    return {
      styleData: {
        topText: "",
        background: "#2eabee",
        TextColor: "#FFF",
      },
    };
  },
  computed: {
    ...mapState(["userType"]),
  },
  watch: {},
  async onLoad(options) {
    // if (this.userType == 1) {
    //   this.$refs.recruit.sortType = 3;
    //   this.$refs.recruit.jobs();
    // }
  },
  async onShow() {
    if (this.userType === "1") {
      this.$refs.recruit.pageNum = 1
      this.$refs.recruit.getStorageFun();

      if (this.$store.state.pathData) {
        let key = Object.keys(this.$store.state.pathData);
        let valueData = Object.values(this.$store.state.pathData);

        console.log(key, "keykeykey");
        console.log(valueData);

        if (key[0] === "sortType") {
          this.$refs.recruit.sortType = valueData[0];
          this.$refs.recruit.enterpriseScales = null
        }
        if (key[0] === "enterpriseScales") {
          this.$refs.recruit.enterpriseScales = valueData[0];
          this.$refs.recruit.sortType = null
        }
        if (key[0] === "longitude") {
          this.$refs.recruit.enterpriseScales = null
          this.$refs.recruit.sortType = 3;
        }
      }
      this.$refs.recruit.jobs();
    }
    if (this.userType === "2") {
      this.$refs.talent.form.pageNum = 1
      this.$refs.talent.getListFn()
    }
  },
  onReady() { },
  methods: {},
  mounted() { },
  onHide() {
    uni.removeStorageSync('talantIndustryId')
  },
  onShareAppMessage(res) {
    console.log(res);
  },
};
</script>
<style lang="scss" scoped>
.home-app {
  position: relative;
  height: 100%;
}
</style>
